home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / ABUSESRC.ZIP / AbuseSrc / imlib / port / mac / timing.c < prev    next >
C/C++ Source or Header  |  1996-04-11  |  817b  |  39 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #ifdef __POWERPC__
  4. #include <time.h>
  5. #else
  6. #include <sys/time.h>
  7. #endif
  8. #include <unistd.h>
  9. #include "timing.hpp"
  10.  
  11. void timer_init() { ; }
  12. void timer_uninit() { ; }
  13.  
  14.  
  15. double time_marker::diff_time(time_marker *other)
  16. {  
  17.   return (double)(seconds-other->seconds)+  (double)(micro_seconds-other->micro_seconds)/1000000;
  18. }
  19.  
  20. void time_marker::get_time()
  21. {
  22.   micro_seconds = clock();
  23.   seconds = micro_seconds/CLOCKS_PER_SEC;
  24.   micro_seconds = (micro_seconds%CLOCKS_PER_SEC)*1000000/CLOCKS_PER_SEC;
  25. }
  26.  
  27. time_marker::time_marker() { get_time(); }
  28.  
  29. void milli_wait(unsigned wait_time)
  30. {
  31.     clock_t tim;
  32.     
  33.     tim = clock();
  34.     tim += (clock_t)(wait_time*CLOCKS_PER_SEC/1000);
  35.     while ( (signed long)tim - (signed long)clock() > 0 ) ;
  36. //        SystemTask();
  37. }
  38.  
  39.